import java.io.IOException;  
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.Header;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
  


  

  
public class DeliverPost {  
    public static void post() throws ClientProtocolException, IOException{    
  
        HttpClient  httpClient =  new DefaultHttpClient();    
          //去掉cookie设置，采用httpclient的默认cookie设置  
        String url = "http://localhost:8080/fda/deliverCompSave.action";    
        List<NameValuePair> formparams = new ArrayList<NameValuePair>();
        formparams.add(new BasicNameValuePair("deliver.outtype", "400401"))  ;  
        formparams.add( new BasicNameValuePair("deliver.outtime", "2011-08-22")) ;  
        formparams.add(new BasicNameValuePair("deliver.outbillno", "1"));
        formparams.add(new BasicNameValuePair("pizhwh", "国药准字H61022101"));
        formparams.add( new BasicNameValuePair("deliver.unit", "500103"));
        formparams.add( new BasicNameValuePair("deliver.nums", "20"));
        formparams.add( new BasicNameValuePair("xvkz", "bc898ad944c463f13ea463e16a043787"));
        formparams.add( new BasicNameValuePair("ckxvkz", "d271cc950b207415678f612708a77cef"));
        formparams.add( new BasicNameValuePair("deliver.doman", "2149"));
        formparams.add(  new BasicNameValuePair("deliver.isend", "3201"));
        formparams.add(  new BasicNameValuePair("deliver.batch", "1"));
       
        UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
        HttpPost httppost = new HttpPost(url);
        httppost.setEntity(entity);
        System.out.println(httppost.getURI());
        httpClient.execute(httppost);
    }
      
public static void main(String[] args) throws ClientProtocolException, IOException{  
      new DeliverPost().post();
          
    }  
} 